/*
 * @(#)CDTransformer.java
 * Date 2013-09-27
 * Version 1.0
 * Author Jim Horner
 * Copyright (c)2012
 */


package us.hornerscorners.lamppost.hl7v3common.transformer;

import javax.enterprise.context.ApplicationScoped;

import org.hl7.v3.CD;

import us.hornerscorners.lamppost.hl7v3common.constant.ControlCode;

import us.hornerscorners.lamppost.transformer.AbstractTransformer;


/**
 * Class description
 *
 *
 * @version        v1.0, 2013-09-27
 * @author         Jim Horner
 */
@ApplicationScoped
public class CDTransformer extends AbstractTransformer<String, CD> {

    /**
     * Constructs ...
     *
     */
    public CDTransformer() {
        super();
    }

    /**
     * Method description
     *
     *
     * @param controlCode
     *
     * @return
     */
    public CD transform(ControlCode controlCode) {
        
        return transform(controlCode.getCode(), null, null, null);
    }

    /**
     * Method description
     *
     *
     * @param code
     *
     * @return
     */
    @Override
    public CD transform(String code) {

        return transform(code, null, null, null);
    }

    /**
     * Method description
     *
     *
     * @param code
     * @param codeSystem
     *
     * @return
     */
    public CD transform(String code, String codeSystem) {

        return transform(code, codeSystem, null, null);
    }

    /**
     * Method description
     *
     *
     * @param code
     * @param codeSystem
     * @param systemName
     *
     * @return
     */
    public CD transform(String code, String codeSystem, String systemName) {

        return transform(code, codeSystem, systemName, null);
    }

    /**
     * Method description
     *
     *
     * @param code
     * @param codeSystem
     * @param systemName
     * @param displayName
     *
     * @return
     */
    public CD transform(String code, String codeSystem, String systemName,
                        String displayName) {

        CD result = new CD();

        result.setCode(code);
        result.setCodeSystem(codeSystem);
        result.setCodeSystemName(systemName);
        result.setDisplayName(displayName);

        return result;
    }
}
